package com.qqgame.hlddz;

import android.app.ActivityOptions;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class GoCompanyActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SharedPreferences sharedPreferences = getSharedPreferences("MyPreferences", MODE_PRIVATE);
        String display2AppValue = sharedPreferences.getString("display2App", "1");

        if ("1".equals(display2AppValue) || "".equals(display2AppValue)) {
            gaoDe();
        }
        if ("2".equals(display2AppValue)) {
            baidu();
        }
        if ("3".equals(display2AppValue)) {
            gaoDe();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            baidu();
        }

        finish();

    }

    private void gaoDe() {
        Intent intent = new Intent();
        intent.setAction("com.autonavi.amapauto.AUTO_WIDGET_GO_COMPANY");
        sendBroadcast(intent);
    }

    private void baidu() {
        Intent secondIntent = new Intent();
        secondIntent.setData(Uri.parse("baidumap://map/navi/common?addr=company&coord_type=gcj02&src=webapp.companyName.appName"));
        startActivity(secondIntent);
    }


}